package com.chinacoal.microservice.mapper;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.chinacoal.microservice.pojo.CcmsSmartleasingTenant;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

/**
 * @author zhuliang
 * @version V1.0
 * @Description: 运维管理-租户管理-mybatis-plus接口类
 * @date 2020-11-17 9：26
 */
public interface CcmsSmartleasingTenantMapper extends BaseMapper<CcmsSmartleasingTenant> {

    /**
     * @Description: 根据合同查询对应的租户信息
     * @author zhuliang
     * @date 2020/11/17 10:42
     */
    CcmsSmartleasingTenant getAllByContract (@Param("fkTenantId") String fkTenantId);

    /**
     * @Description: 分页查询所有信息
     * @author zhuliang
     * @date 2020/11/18 16:20
     */
    List<CcmsSmartleasingTenant> getAllByPage(Page<CcmsSmartleasingTenant> toPage,
                                              @Param("fkPropertyCompanyId") String fkPropertyCompanyId,
                                              @Param("fkAdministrativeOfficeId") String fkAdministrativeOfficeId);

    /**
     * @Description: 根据租户id查询租户信息
     * @author zhuliang
     * @date 2021/1/7 18:50
     */
    CcmsSmartleasingTenant getAllByTenantId(@Param("pkTenantId") String pkTenantId,
                                            @Param("fkPropertyCompanyId") String fkPropertyCompanyId,
                                            @Param("fkAdministrativeOfficeId") String fkAdministrativeOfficeId);

    /**
     * @Description: 批量删除
     * @author zhuliang
     * @date 2020/11/18 17:37
     */
    void updateToDeleteById(@Param("lastUpdatedBy") Integer lastUpdatedBy,
                            @Param("lastUpdateDate") Date lastUpdateDate,
                            @Param("deleteSign") Byte deleteSign,
                            @Param("pkTenantId") String[] pkTenantId,
                            @Param("fkPropertyCompanyId") String fkPropertyCompanyId,
                            @Param("fkAdministrativeOfficeId") String fkAdministrativeOfficeId);

    /**
     * @Description: 条件查询所有信息待分页
     * @author zhuliang
     * @date 2020/12/12 11:38
     */
    List<CcmsSmartleasingTenant> getAllByCondition(@Param("tenantType") Integer tenantType,
                                                   @Param("pkBuildingId") String pkBuildingId,
                                                   @Param("inputString") String inputString,
                                                   @Param("contactPhone") String contactPhone,
                                                   @Param("idcardNumber") String idcardNumber,
                                                   @Param("housingAssetsCode") String housingAssetsCode,
                                                   @Param("houseNumber") String houseNumber,
                                                   @Param("fkPropertyCompanyId") String fkPropertyCompanyId,
                                                   @Param("fkAdministrativeOfficeId") String fkAdministrativeOfficeId,
                                                   Page<CcmsSmartleasingTenant> toPage);

    /**
     * @Description: 批量修改租户的缴费状态
     * @author zhuliang
     * @date 2020/12/10 19:41
     */
    void batchUpdate(@Param("lastUpdateDate") Date lastUpdateDate,
                     @Param("lastUpdatedBy") Integer lastUpdatedBy,
                     @Param("payment") String payment,
                     @Param("pkTenantId") List<String> pkTenantId);

    /**
     * @Description: 根据合同id修改租户信息
     * @author zhuliang
     * @date 2020/12/11 14:42
     */
    void updateByContractId(@Param("lastUpdateDate") Date lastUpdateDate,
                            @Param("lastUpdatedBy") Integer lastUpdatedBy,
                            @Param("payment") String payment,
                            @Param("pkContractId") String pkContractId);

    /**
     * @Description: 验证是否有这个租户
     * @author zhuliang
     * @date 2020/12/21 18:33
     */
    String judgmentLogin(@Param("userName") String userName,
                         @Param("passWord") String passWord);

    /**
     * @Description: 微信端-租户信息的回显
     * @author zhuliang
     * @date 2020/12/23 10:36
     */
    CcmsSmartleasingTenant getNameByWechat(@Param(value = "contactPhone") String contactPhone);

    /**
     * @Description:  微信-查询是否有openid
     * @author zhuliang
     * @date 2020/12/25 10:05
     */
    String getOpenID(@Param("contactPhone") String contactPhone);

    /**
     * @Description: 重置密码的方法
     * @author zhuliang
     * @date 2021/1/7 19:04
     */
    void resetPassword(@Param("lastUpdateDate") Date lastUpdateDate,
                       @Param("lastUpdatedBy") Integer lastUpdatedBy,
                       @Param("tenantPassword") String tenantPassword,
                       @Param("pkTenantId") String pkTenantId,
                       @Param("contactPhone") String contactPhone);

    /**
     * @Description: 查询是否有此租户
     * @author zhuliang
     * @date 2021/1/8 9:12
     */
    String inquireIsThereTenant(@Param("idcardNumber") String idcardNumber,
                                @Param("tenantType") String tenantType);
    
    /**
     * @Description: 修改租户的信息
     * @author zhuliang
     * @date 2021/1/8 18:27
     */
    void updateData(@Param("email") String email,
                     @Param("contactPhone") String contactPhone,
                     @Param("wxOpenId") String wxOpenId);

    /**
     * @Description: 身份证或统一信用代码或电话号码的唯一性验证
     * @author zhuliang
     * @date 2021/1/8 19:04
     */
    String identityUniquenessVerification(@Param("contactPhone") String contactPhone,
                                          @Param("tenantType") String tenantType,
                                          @Param("pkTenantId") String pkTenantId);
}
